package jrebel.comm;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

public class ConfBody {
	private boolean debugMode;
	private boolean trackRetransforms;
	private boolean unsafeMode;
	private boolean dumpClasses;
	private boolean isRemoteMode ;
	

	private String dumpDir;
	private String scriptOutputFile;
	private volatile String password;


	private String newPassword ;

	public ConfBody() {
		debugMode = true;
		trackRetransforms = false;
		unsafeMode = false;
		dumpClasses = true;
		dumpDir = ".";
		scriptOutputFile = ".";
	}

	protected void read(ObjectInput in) throws IOException,
			ClassNotFoundException {
		// TODO Auto-generated method stub
		this.debugMode = in.readBoolean();
		this.trackRetransforms = in.readBoolean();
		this.unsafeMode = in.readBoolean();
		this.dumpClasses = in.readBoolean();
		this.isRemoteMode = in.readBoolean();

		this.dumpDir = in.readUTF();
		this.scriptOutputFile = in.readUTF();
		this.password = in.readUTF();
		this.newPassword = in.readUTF();
	}

	protected void write(ObjectOutput out) throws IOException {
		// TODO Auto-generated method stub
		out.writeBoolean(debugMode);
		out.writeBoolean(trackRetransforms);
		out.writeBoolean(unsafeMode);
		out.writeBoolean(dumpClasses);
		out.writeBoolean(isRemoteMode);


		out.writeUTF(dumpDir == null ? "" : dumpDir);
		out.writeUTF(scriptOutputFile == null ? "" : scriptOutputFile);
		out.writeUTF(password == null ? "" : password);
		out.writeUTF(newPassword == null ? "" : newPassword);

	}

	public boolean isRemoteMode() {
		return isRemoteMode;
	}

	public void setRemoteMode(boolean isRemoteMode) {
		this.isRemoteMode = isRemoteMode;
	}

	public boolean isDebugMode() {
		return debugMode;
	}

	public void setDebugMode(boolean debugMode) {
		this.debugMode = debugMode;
	}

	public boolean isTrackRetransforms() {
		return trackRetransforms;
	}

	public void setTrackRetransforms(boolean trackRetransforms) {
		this.trackRetransforms = trackRetransforms;
	}

	public boolean isUnsafeMode() {
		return unsafeMode;
	}

	public void setUnsafeMode(boolean unsafeMode) {
		this.unsafeMode = unsafeMode;
	}

	public boolean isDumpClasses() {
		return dumpClasses;
	}

	public void setDumpClasses(boolean dumpClasses) {
		this.dumpClasses = dumpClasses;
	}

	public String getDumpDir() {
		return dumpDir;
	}

	public void setDumpDir(String dumpDir) {
		this.dumpDir = dumpDir;
	}

	public String getScriptOutputFile() {
		return scriptOutputFile;
	}

	public void setScriptOutputFile(String scriptOutputFile) {
		this.scriptOutputFile = scriptOutputFile;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	public String getNewPassword() {
		return newPassword;
	}

	public void setNewPassword(String newPassword) {
		this.newPassword = newPassword;
	}
}
